class NewWelder extends Welder;

var float PenaltyValue;

simulated function Tick(float dt)
{
	if (FireMode[0].bIsFiring)
		FireModeArray = 0;
	else if (FireMode[1].bIsFiring)
		FireModeArray = 1;
	else
		bJustStarted = true;

	if (NewWeldFire(FireMode[FireModeArray]).LastHitActor != none && VSize(NewWeldFire(FireMode[FireModeArray]).LastHitActor.Location - Owner.Location) <= (weaponRange * 1.5) )
	{
		bNoTarget = false;
		ScreenWeldPercent = ((NewWeldFire(FireMode[FireModeArray]).LastHitActor.WeldStrength) / (NewWeldFire(FireMode[FireModeArray]).LastHitActor.MaxWeld)) * 100;
		if( ScriptedScreen==None )
			InitMaterials();
		ScriptedScreen.Revision++;
		if( ScriptedScreen.Revision>10 )
			ScriptedScreen.Revision = 1;

		if ( Level.Game != none && Level.Game.NumPlayers > 1 && bJustStarted && Level.TimeSeconds - LastWeldingMessageTime > WeldingMessageDelay )
		{
			if ( FireMode[0].bIsFiring )
			{
				bJustStarted = false;
				LastWeldingMessageTime = Level.TimeSeconds;
				if( Instigator != none && Instigator.Controller != none && PlayerController(Instigator.Controller) != none )
				{
				    PlayerController(Instigator.Controller).Speech('AUTO', 0, "");
				}
			}
			else if ( FireMode[1].bIsFiring )
			{
				bJustStarted = false;
				LastWeldingMessageTime = Level.TimeSeconds;
				if( Instigator != none && Instigator.Controller != none && PlayerController(Instigator.Controller) != none )
				{
				    PlayerController(Instigator.Controller).Speech('AUTO', 1, "");
				}
			}
		}
	}
	else if (NewWeldFire(FireMode[FireModeArray]).LastHitActor == none || NewWeldFire(FireMode[FireModeArray]).LastHitActor != none && VSize(NewWeldFire(FireMode[FireModeArray]).LastHitActor.Location - Owner.Location) > (weaponRange * 1.5) && !bNoTarget  )
	{
		if( ScriptedScreen==None )
			InitMaterials();
		ScriptedScreen.Revision++;
		if( ScriptedScreen.Revision>10 )
			ScriptedScreen.Revision = 1;
		bNoTarget = true;
		if( ClientState != WS_Hidden && Level.NetMode != NM_DedicatedServer && Instigator != none && Instigator.IsLocallyControlled() )
		{
		  PlayIdle();
		}
	}
	if ( AmmoAmount(0) < FireMode[0].AmmoClass.Default.MaxAmmo)
	{
		AmmoRegenCount += (dT * AmmoRegenRate );
		ConsumeAmmo(0, -1*(int(AmmoRegenCount)));
		AmmoRegenCount -= int(AmmoRegenCount);
	}
}

defaultproperties
{
	SleeveNum=0
	HudImage=Texture'mswp_03.WelderReskinDT_T.welderDT_unselected'
    SelectedHudImage=Texture'mswp_03.WelderReskinDT_T.WelderDT_Selected'
	Mesh=SkeletalMesh'mswp_03.WReskinDTMesh'
    Skins(0)=Combiner'KF_Weapons_Trip_T.hands.hands_1stP_military_cmb'
    Skins(1)=TexOscillator'KillingFloorWeapons.Welder.FlameOSC'
	Skins(2)=Shader'KillingFloorWeapons.Welder.WelderShader'
	StandardDisplayFOV=75.000000
	PlayerViewOffset=(X=10.000000,Y=0.000000,Z=0.000000)
	BobDamping=3.000000
	DrawScale=0.2
	AttachmentClass=Class'WelderOldAttachment'
	
    FireModeClass(0)=Class'NewWeldFire'
    FireModeClass(1)=Class'NewUnWeldFire'
    PickupClass=Class'NewWelderPickup'
    ItemName="Welder"
	PenaltyValue=0.0
}
